#include "../include/main.h"
#include "../include/gamehandler.h"

class MainWind;

MainWind* win;

class MainWind : public Main  {

    GameHandler* handler;
public:

    MainWind(int* argc, char **argv[]): Main(argc, argv)
    {
		if (*argc<2){
			std::cerr << "please specify a game type as argument";
			exit(1);
		}
		char** newArgv = *argv;
		newArgv++;
		newArgv++;
		handler = GameHandler::loadHandler( (*argv)[1], (*argc)-2, newArgv);
    }
    void runBots(){
        handler->runAll();
    }
    void run()
    {
        handler->win->show_all();
        Main::run(*handler->win);
    }
};

int main (int argc, char *argv[]){
    Glib::init();
    Gio ::init();
    if( ! g_thread_supported() )
        g_thread_init( NULL );

    MainWind kit(&argc, &argv);
    win = &kit;
    kit.run();
}

